package com.spring.boot.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.spring.boot.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Daniel ZTQ
 * @Date: 2021/01/01 12:13
 * @Description: TODO
 */
@Service
public interface UserMapper extends BaseMapper<User> {
    /**
     * 根据身份证号查询用户信息
     * */
    @Select("select * from user where id_card=#{idCard}")
    List<User> getUserByIdCare(@Param("idCard")String idCard);

    /**
     * 根据用户id查询用户信息
     * */
    @Select("select * from user where uid=#{uid}")
    User getUserByUid(@Param("uid")String uid);


    /**
     * 根据用户id，进行修改密码
     * */
    @Update("update user set password=#{password} where uid=#{uid}")
    int updatePassword(@Param("uid")String uid,@Param("password")String password);
}
